package com.wjj.sixinone.controller.admin;


import com.wjj.sixinone.common.enums.ApiTypeConst;
import com.wjj.sixinone.common.pojo.vo.EmployeeForm;
import com.wjj.sixinone.common.pojo.vo.EmployeeVo;
import com.wjj.sixinone.common.util.Result;
import com.wjj.sixinone.service.EmployeeService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小王不秃头
 * @since 2024-07-22
 */
@RestController
@RequestMapping(ApiTypeConst.API_ADMIN+"/employee")
public class EmployeeController {
    @Autowired
    private EmployeeService service;
    @GetMapping("/listDepartmentName")
    public Result listDepartmentName(){
        return service.listDepartmentName();
    }
    @GetMapping("/selectEmployeeByLimit")
    public Result selectEmployeeByLimit(EmployeeVo employeeVo){
        return service.selectEmployeeByLimit(employeeVo);
    }
    @PostMapping("/updateById")
    public Result updateById(@RequestBody EmployeeForm employeeForm){
        return service.updateEmployeeById(employeeForm);
    }
    @PostMapping("/addEmployee")
    public Result addEmployee(@RequestBody EmployeeForm employeeForm){
        return service.addEmployee(employeeForm);
    }

    @GetMapping("/uploadExcel")
    public void uploadExcel(HttpServletResponse httpServletResponse){
        service.uploadExcel(httpServletResponse);
    }
    @PostMapping("/deleteById")
    public Result deleteById(@RequestBody Map<String,String> map){
        return service.deleteById(map);
    }
    @GetMapping("/getEmployeeNameByDepartmentName")
    public Result getEmployeeNameByDepartmentName(@RequestParam("departmentName") String departmentName){

        return service.getEmployeeNameByDepartmentName(departmentName);
    }
    @GetMapping("/listDoctorName")
    public Result selectEmployeeByDepartmentName(){
        return service.selectEmployeeByDepartmentName();
    }

}

